<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/2/6
 * Time: 15:32
 */

namespace app\console;


use app\common\model\Order;
use app\common\OrderStatus;
use think\console\Command;
use think\console\Input;
use think\console\Output;


class Rebates extends Command
{
    protected function configure()
    {
        $this->setName('rebates')->setDescription('runing rebates | zhi xing fan li  ');
    }

    protected function execute(Input $input, Output $output)
    {
        $this->main();
    }

    function main()
    {
        $order_list = Order::all(["order_status_id" => [">=", OrderStatus::QUERENSHOUHUO], "rebates" => 0]);
        //@ todo  返利操作
        foreach($order_list as $order){
            OrderStatus::rebates($order,"系统自动执行返利操作");
        }
    }
}